import axios from "axios";

export const handleAction = (data) => ({ type: "change", data });

export const addAction = () => ({ type: "addlist" });
export const deleteAction = (index) => ({
  type: "deleteitem",
  index,
});
export const initListAction = (data) => ({
  type: "init",
  data,
});
export const AsyncAction = (data) => {
  return (dispatch) => {
    axios.get("city.json").then((res) => {
      console.log(res.data);
      dispatch(initListAction(res.data));
    });
  };
};

export const ChangeAction = (value) => ({
  type: "change_inputv",
  value,
});

export const pushAction = () => ({
  type: "change_list",
});
export const delAction = (index) => ({
    type: "change_del",
    index,
  });